/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service;

import form.Usuario;
import hibernate.EducacionITSessionManager;
import java.util.List;
import org.hibernate.HibernateException;
import org.hibernate.Session;

/**
 *
 * @author Hugo
 */
public class usuarioService {

    public static List validaLogin(String user, String pass) throws HibernateException, Exception {


        String laConsulta = "FROM Usuario WHERE username = '" + user + "' and password ='" + pass + "' ";

        Session session = null;

        // Obtiene la sesion de trabajo e inicia una transaccion
        session = EducacionITSessionManager.getSession();
        session.beginTransaction();

        List<Usuario> elUsuario = session.createQuery(laConsulta).list();
        

        session.close();

        return elUsuario;

    }
}
